/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 *
 * Author: zhaoshujin
 * Date: 2011-9-7 下午01:08:10
 */
package com.memcached;

import java.util.Calendar;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author zhaoshujin
 * 
 */
public class Demo {

	public static void main(String[] args) {

		Logger logger = LoggerFactory.getLogger(Demo.class);

		Memcached mem = Memcached.getInstance();

		Calendar cal = Calendar.getInstance();

		// cal.set(Calendar.HOUR_OF_DAY, 24);
		// cal.set(Calendar.MINUTE, 0);
		// cal.set(Calendar.SECOND, 0);

		System.out.println("current:" + cal.getTime());
		cal.add(Calendar.MINUTE, 1);

		Object ob = null;

		try {

			ob = mem.get("sysdate");
			if (ob == null)
				mem.add("sysdate", cal.getTime(), cal.getTime());

			System.out.println("memcached:" + ob.toString());

			// mem.delete("sysdate");

		} catch (Exception e) {
			e.printStackTrace();
			logger.info(e.getMessage());
		}
	}
}
